約 3,963,786 件
https://w.atwiki.jp/kindaidensan/pages/12.html
java班 Java班のトップページです。現在ライブラリ(DJGL)の使い方の解説を執筆中です。 Javaでゲームを作るためのライブラリです。 このwikiではJavaでゲームを作成するときのノウハウ的なのも載せています。Java用に書いていますが、他の言語とかゲームエンジンでも応用出来ると思います。 部内用に作りましたけど部外・学外の方でも利用可能です。 ライセンスはMITのつもりですけど、別に著作権表示とかライセンスの表示はいりません。あったら作者が嬉しいな程度です。 左のメニューに載ってないページは作りかけのページです。 ライブラリ本体のあるページ DJGL-更新履歴 ライブラリのjavadoc http //kiki33.bitbucket.org/ テンプレート 名前 コメント すべてのコメントを見る
https://w.atwiki.jp/jasagiri/pages/28.html
framework sproutcore:http //www.sproutcore.com/ 翻訳:http //www.memorycraft.jp/wiki/SproutCore%20ドキュメント翻訳.html protoscript:http //protoscript.com/ jQuery JesterJS:http //github.com/thoughtbot/jester/tree/master JsonPath:http //goessner.net/articles/JsonPath/ ActiveRecord.js:http //github.com/aptana/activejs/tree/master Socks:http //github.com/petejkim/socks/tree/master Red ( ruby2javascript ) http //wiki.github.com/jessesielaff/red RedShift ( DOM Scripting Library for Red ) http //github.com/backtik/redshift/tree/master RedSpec red-herring redmaps ruby-red-js http //groups.google.co.jp/group/ruby-red-js == Red を Windows で使う == gem install red gem install ParseTree gem install RubyInline gem install ZenTest gem install sexp_processor 最新がほしければ git clone して gem_home に手動でコピー gem_home /specifications/red-4.1.7.gemspec修正(ParseTree 2.2.0のwindows版は無い) s.add_runtime_dependency(%q ParseTree , [ ~ 2.2.0 ]) = s.add_runtime_dependency(%q ParseTree , [ 2.2.0 ]) gem_home /gems/red-4.1.7/lib/red/executable.rb 54行目修正 File.delete( spew ) = #File.delete( spew ) #コメントアウト IEでは動かない?
https://w.atwiki.jp/ohden/pages/634.html
C#でJavaDocみたいなドキュメントを作りたい Windows 7 Professional Visual Studio 2013 Professional .NetFramework 4.5 使用するツールの選定 『ドキュメンテーションコメント』『XMLコマンド』がキーワード。 ひな形は、『///』って入力するとVisual Studioが勝手に突っ込んでくれる。 試したのはSandcastleとDoxygen。 どちらも出力は可能だが、Office documentへの出力がSandcastleで不可能になってた。昔はできたみたい。 今回は諸事情により、Office document出力が可能なDoxygenを選択。 Sandcastleの導入と使い方 Doxygenの導入と使い方 ドキュメンテーションコメントからOffice document出力をしたい場合 Office document(Word)への出力はrtf形式を利用する。 ※Excel形式の出力方法は、ちょっと見つかってねぇです。(´・ω・`) ※まぁ、XML出力はされるので、PowerShellとか.netとか使ってXMLファイルからごにょごにょすれば出力できるようになるっちゃぁなるんですが... 1.rtf形式の出力を有効化 2.出力されたrtfファイルのフィールドを更新 3.外部リンクになっている画像を埋め込みに変更 で対応できた。 Help File Formats Sandcastle will produce output that can be used to create help files in various formats. However, it cannot create the actual file that is the end result. For that, help compilers or third-party build tools are required. Below is a summary of the help file formats and the tools needed to produce them. HTML Help 1 HTML Help 1 files are standalone help files with a .chm extension. This is the oldest help file format and these files can be viewed on any system without any special viewers. The Help 1 compiler is installed as part of the Microsoft HTML Help Workshop. Microsoft Help 2 The Microsoft Help 2 format produces help files with a .HxS extension. These are not standalone files. In order to view them, they must be integrated into a help collection. These are typically used to provide help for control libraries and tools and are integrated into the help collections used by Microsoft Visual Studio 2008 and earlier. The Help 2 compiler does not appear to be available separately and must be installed as part of one of the SDKs for Visual Studio 2008 or earlier. Microsoft Help Viewer This is the latest help file format and produces help files with a .mshc extension. These help files are typically used to provide help for control libraries and tools used with Visual Studio 2010 and later. They are similar to Help 2 files in that they must be installed into a collection to be viewed but they do not require a compiler. Instead, the help content is compressed into a ZIP-format archive file. Third-party build tools for Sandcastle will provide the support necessary to create the help archive and its related configuration file. Open XML Open XML files are viewable in applications such as Microsoft Word and Open Office. They have a .docx extension and are ZIP-format archive files. Third-party build tools for Sandcastle will provide the support necessary to create the document archive file. Since these are word processing documents, they are convertible to other file formats such as PDF using other third-party tools and applications. There are certain requirements that need to be met in order to produce valid Open XML documents. In addition, this file format is best suited to help content with 1,000 topics or less due to the number of pages that can be generated by much larger projects. The larger the help content, the more unwieldy the resulting document can become. See the Open XML Document File Format topic in the Sandcastle Help File Builder help file for details. Websites The topic files produced by Sandcastle are HTML files and can be used to create help content that is uploaded to a web server. However, Sandcastle itself does not provide any support for creating a web-based table of content, index, or search functionality. These features are left to the third-party build tools. The following steps will check for the Help 1 and Help 2 compilers and give you instructions on downloading and installing them if necessary. Click the Next button to continue. HTML Help 1 Compiler HTML Help 1 files are standalone help files with a .chm extension. This is the oldest help file format and these files can be viewed on any system without any special viewers. Help 1 Compiler Found It has been determined that the HTML Help 1 compiler is installed on this system (Location C \Program Files (x86)\HTML Help Workshop). No further action is required in this step. Click the Next button to continue. Microsoft Help 2 Compiler The Microsoft Help 2 format produces help files with a .HxS extension. These are not standalone files. In order to view them, they must be integrated into a help collection. These are typically used to provide help for control libraries and tools and are integrated into the help collections used by Microsoft Visual Studio 2008 and earlier. The Microsoft Help 2 compiler could not be found on this system. If you will be creating Help 2 files, you will need to follow the instructions below to download and install it using one of the listed SDKs. If you will not, you can safely skip this step. You can run this application again to install it later if needed. Because the Help 2 compiler is not available separately, it must be installed as part of the Visual Studio SDK. This may require that you have the associated version of Microsoft Visual Studio installed as well. It is only available in SDKs for Visual Studio 2008 and earlier. You only need to install one of the following SDKs to obtain the Help 2 compiler components. The SDKs for Visual Studio 2005 and 2008 both contain an outdated version of Sandcastle. This can cause problems after installing Sandcastle as the environment variable that it uses to find its components may point to the wrong location causing build errors. If you install one of the SDKs, it is highly recommended that you reboot before continuing with the Sandcastle tools installation so that the issue can be detected and fixed. If you have Visual Studio 2010 or later Help 2 files are not used by Visual Studio 2010 or later and their related SDKs do not contain the Help 2 compiler. If you have Visual Studio 2008 NOTE You must install version 1.0 of the Visual Studio 2008 SDK. Version 1.1 does not contain the Help 2 compiler components. ・Click this link to go to the download page Visual Studio 2008 SDK Version 1.0 ・Once the page opens, click the Download button. ・When prompted, click the Run button to download and immediately run the installer. ・When it has finished, come back to this application and click the Search Again button below to ensure that the Help 2 compiler can be found. ・It is highly recommended that you reboot before installing the remainder of the Sandcastle tools so that a potential issue with the SDK can be detected and fixed prior to installing Sandcastle. See the note above for more information. If you have Visual Studio 2005 ・Click this link to go to the download page Visual Studio 2005 SDK Version 4.0 ・Once the page opens, click the Download button. ・When prompted, click the Run button to download and immediately run the installer. ・When it has finished, come back to this application and click the Search Again button below to ensure that the Help 2 compiler can be found. ・It is highly recommended that you reboot before installing the remainder of the Sandcastle tools so that a potential issue with the SDK can be detected and fixed prior to installing Sandcastle. See the note above for more information. If you have Visual Studio 2003 ・Click this link to go to the download page Visual Studio .NET Help Integration Kit 2003 ・Once the page opens, click the Download button. ・When prompted, click the Run button to download and immediately run the installer. ・When it has finished, come back to this application and click the Search Again button below to ensure that the Help 2 compiler can be found. The Microsoft Help 2 compiler does not appear to be installed. Microsoft Help 2 files cannot be produced without it. If you will not be creating them, you can safely skip this step. If you will, you should download and install it before proceeding. Do you want to proceed without? Sandcastle Help File Builder and Tools The Sandcastle Help File Builder (SHFB) was created to provide project managment features, add the missing NDoc-like features that are used most often, and provide graphical and command line based tools to build a help file in an automated fashion using the Sandcastle Tools. The most recent version of both can always be found at the Sandcastle Help File Builder project on CodePlex. This will install the core tools and build engine and the standalone GUI project management system. A Visual Studio package is also available that will allow you to create, manage, and build help file projects from within Visual Studio. It is installed separately. The core tools and build engine are required for it to work correctly and must be installed first. See the topics in the Getting Started section of the Sandcastle Help File Builder help file for information on additional tools that you may find useful and how to create your first project. The Sandcastle Help File Builder could not be found on this system. Please click the Install SHFB button below. A separate installer will be launched to perform the installation. Once it has completed, return to this application to continue installing the remainder of the tools. You may need to reboot when done so that changes to the system environment variables take effect. http //shfb.codeplex.com/ 更新日: 2014年11月19日 (水) 11時49分57秒 名前 コメント すべてのコメントを見る
https://w.atwiki.jp/pfantasy/pages/51.html
前ページ次ページjAvA 幸い怪我人はいなかった。なんだ、どうした、と怒声や驚愕といったさまざまな 反応をしている村人達が今の騒ぎを聞きつけて周りに集まってきた。 リナが村人達にこれまでの経緯と状況を簡単に説明してくれている。 リナの家を壊したというのに心なしか彼女は嬉々としている…。なぜだ。 俺はリナと共に、俺に興味津々といった趣の村人達に囲まれながら村の長老の家へと つれていかれた。 「おぬしか…異世界から来た客人というのは…」 焦った。この事でまた少しばかり混乱もした。彼らは俺の敵なのか?友好的にしてくれているが 彼らを信用していいのか?しかし、この老人が俺を元の世界に帰る方法を知っている のかもしれない。 先ほどの化け物をオークと言ったが、ゲームなんかに出てくる オークはもっとこう、最初に出てくる雑魚キャラじゃないのか?人間の格闘家の ゆうに3倍は超える筋肉とあの獰猛な表情。そして一歩間違えれば俺は死んでいたという 圧倒的なリアリティ。恐い…。戻りたい…。元の世界に帰りたい…。 そう俺に選択肢はない。 俺はあくまで敵意はない事を説明し、又長老と呼ばれる老人に事の経過を改めて説明し、 もとの世界に帰る方法はあるのかとたずねた。 「ふむ、では、もう一度おぬしが今考えられる限りの魔法をもう一度使ってみせてくれぬか」 俺の質問に対しなぜこのような質問が帰ってくるのかわからなかったが 前にも考えたように、今の俺に選択肢はない。リナから先ほどの本を受け取り パラパラとページを見渡す。俺は苦笑した。なんだこりゃ、javadocのAPIリファレンスと そっくりなページまであるじゃないか。くっ、こうなるとギャグの世界じゃないのか?と正直思った。 大気中のエレメント郡がメンバ化された構造体クラス一覧のページがある。 よし、これだ。これをやってみよう。 水を構成する精霊を配列でインスタンス化し常に要素数をインクリメントしながらループ。 脳の中が断続的に真っ白になる。こ、これは…きついぞ…。 なにやら周りを押し飛ばす、一種オーラのようなものが自分の体の回りに まとわりついてくる。何かわからないが、それでも「何か」のすごい力を感じる。 全身が真っ白になる。ガタガタと振るえが止まらない。 「いかん!精神が呪文詠唱の際の無限繰り返しの谷にはまったようじゃ!! こうなっては間違いなく精神に異常をきたす!皆のもの、彼を押さえつけて横に寝かせるんじゃ!!」 徐々に意識が朦朧としていく中俺は思った。無限ループ?冗談じゃない。 まだだ、まだいける。何かの力が凄い勢いで伝わってくる。 意識がいよいよヤバくなってくる。ああ…そろそろ限界だ。 ハハ、まるでデスマーチ中の睡魔で朦朧としてくるあの時みたいだ。 長老さん、よく見ときな。あんたこんな事も知らないようだな。 俺はこれでもいっぱしのプロのプログラマーだぜ? これは無限ループに見えるかもしれないがそうじゃない。これは 再 帰 だ !! ルーチンがブレイクした瞬間力が一気に開放される。 俺の体の全身から恐ろしいほどのまばゆく大きな光が天に向かって発射された。 混濁して倒れながら最後にみた長老の家の天井は光が透き通って 壊れてはおらず、なぜかその事に安心しながら俺は気を失った。 その直後、雲一つない晴天だった空は急にどんよりとした雲に覆われ、 と思うといきなり雷雨と共に大雨が降った。 「こ…これは…、これは!!!我が太陽共和国宮廷一の魔術師でも使う事の出来ない 自然を操作する大魔法…。そんな、そんな馬鹿な…!! い、異世界の魔術師達は皆このような高等魔法を使う事が出来るのか…!!!」 前ページ次ページjAvA
https://w.atwiki.jp/note4recurrent/pages/29.html
2022/08/24 動的web html:httpサーバー(Apacheなど)がファイル(htmlやimg)を送り返すだけ。今どきのページではJavascriptで埋め込んだコンテンツ(動画など)を同時に送り返すものも多いが。 JAVAの動的web:httpサーバーからアプリケーション・サーバー上で実行されているプログラム(JAVAなど)を呼び出して実行された結果をhtmlで受け取とる。 JAVAの場合、サーブレットとJSPで実装される。 サーブレットはクラスファイル:JAVAのクラスの一種。htmlを出力するメソッドを持っているイメージ。 JSPファイルで中身はhtmlに近い。htmlにjavascriptを埋め込んだようなイメージ。 サーブレット javaプログラムとhtmlの部分以外は、決り文句なのでコピペでOK。 doGet(),doPost() で受け取る doGet はブラウザのアドレスバーから呼び出されたような場合やgetメソッドで呼び出された時に実行されるメソッド。 doPost()は他のサーブレットやJSP、htmlのリンクから呼び出された時に実行される。 htmlを書き出すときは「PrintWriter out = response.getWriter()」 で宣言したインスタンス(この場合はout)のprintlnメソッドにhtml文字列を引数として渡す。このパターンで覚えておけばいい(前に書いたものからコピペすればいい)。 サーブレットの特徴 サーブレットはメソッドだが、「サーバー上で実行」されたときにインスタンス化されているので、どこかでnewすることはない。サーバー上に常駐し、リクエストを待っている状態と考えればよい。 サーブレットはクラスなので、htmlの書き出し部分でもjavaで作った変数をそのまま使える。 サーブレットはJAVAのクラスなので、src配下に置く。 URLパターン:サーブレットを呼び出すためのURLは、基本的にはサーバー/プロジェクト名/サーブレット名と考えれば良い。サーブレット名はサーブレット内の@WebServlet("/ExServlet") に書かれる。 2022/08/29 前先生 JSP JavaServletPage Eclipsの管理上はhtmlと同じフォルダに置く。(授業ではWebContent)サーブレットと異なることに注意。 htmlにJAVAのコードを埋め込むような感じなので、凝ったレイアウトのhtmlファイルを作りやすい。作り込んだhtmlをもらってJAVAを埋め込むといった使い方が主流。 JAVAのifやloopでhtmlの出力を動的に変えることが可能。 サーブレットと同様、htmlとJSPの決り文句はコピペでOK。 コメントの書き方が異なるので注意。間違えると、画面に表示されたりサーバーエラーになる。 if分やfor分のブロックを閉じる閉じのカッコ” %}% ”を忘れやすいので注意。インデントを勝手にやってくれないので見ずらい。 練習問題 通常のJAVAクラスを作って、JSPから呼び出す練習をした。 import する必要がある。それ以外は普通のクラスの呼び出しと一緒。 Form html 部分は通常のhtmlファイルと同様。 submit を post でするとURLに入力した値は表示されない。getだと表示される。 ラジオボタンとチェックボックスの取得方法は次回。 2022/08/31 フォーム StringBuilder sb = new StringBuilder(); sb.append(value); ストリング変数に+で追加するよりメモリ効率が良く速い。Stirngはオブジェクトで+すると新しくオブジェクトを作って値を入れる。 forward は同じプログラム内のサーブレット、JSPしか呼べない Redirect は制限がない。ネットでつながっているところならどこでも呼べる。 下の行はコメントアウトすること //response.getWriter().append("Served at ").append(request.getContextPath()); knowledge.length 配列の個数を調べるときは()がいらない。普通はhensu.length() 2022/09/07 10章 練習課題:7章の例題をコピペすればOK。来週の修了テストもほとんど同じなので、回答をもらって名前とLogicを触ればいい(はず)。 model DataType データをやり取りするためのjavabeans(クラス):input,input2,input3とそれぞれのgetter,setterを持つだけ。 Logic 入力された文字列をつないでDataTypeのinput3にsetするだけのクラス(Control.javaの中で呼び出される:引数はDataType) servlet Control.servlet postを受けてDataTypeをnewし、Logicで文字列をつないでリクエストスコープにDataTypeを保存して、 result.jspをforward WebContent index.jsp 入力フォーム:postでControlに文字列を2つ投げるだけ Web-INF(フォルダ)jsp(フォルダ) output.jsp Control.servlet からforward で呼び出される。リクエストスコープに入っている DataTypeを受け取って表示するだけ。 2022/09/08 import java.sql.*; mySQLの場合 public static void m01() throws Exception { System.out.println( "===== m01() Mysql Sys に接続" ); Class.forName("com.mysql.cj.jdbc.Driver"); String dburl = "jdbc mysql //localhost 3306/sys?characterEncoding=UTF-8 serverTimezone=Asia/Tokyo"; String sql = "SELECT * FROM version"; ----テーブル名 Connection conn = DriverManager.getConnection(dburl, "root", "root");---MySQLのログイン情報 Statement statement = conn.createStatement(); //statement.executeUpdate(sql); ---select 以外 ResultSet rs = statement.executeQuery(sql);---select の場合 //結果の表示 while( rs.next() ) { String sysVer = rs.getString("sys_version"); String mysqlVer = rs.getString("mysql_version"); System.out.println( sysVer + ", " + mysqlVer ); } //開いた順番と逆に閉じる事 rs.close(); statement.close(); conn.close(); } MySQL につなぐための準備 connector/j をダウンロード https //dev.mysql.com/downloads/connector/j/8.0.html https //dev.mysql.com/downloads/file/?id=513221 "C \pleiades\tomcat\9\lib\mysql-connector-java-8.0.30.jar" ビルドパスの構成が必要になるので注意。(外部JARを追加する) ビルドパス>ビルドパスの構成(ダイヤログ)>ライブラリータブ選択>モジュールパスを選択>外部JARの追加ボタン>ファイルダイヤログでダウンロードしたJARを選択>適用して閉じる 動的webプロジェクト作成手順 スッキリわかるサーブレット&JSP入門第2版に合わせるための設定 java11,tomcat9 を使うこと ファイルメニュー「新規」:動的webプロジェクト プロジェクト名入力 ターゲット・ランタイム確認: 構成ボタンを押す javaのバージョンが一致しているか確認(今は11)。必要があれば修正 次へボタン 表示されているフォルダを選んで「除去」ボタンを押し消す 「フォルダーの追加」ボタンを押し、 「src」 を作成:「次へ」ボタン コンテンツ・ディレクトリーを「WebContent」に変更し完了 (出来上がったプロジェクトをパッケージ・エクスプローラーで開く) srcフォルダを右クリックし「新規」フォルダー:model srcフォルダを右クリックし「新規」フォルダー:servlet WebContentの中のWEB-INFフォルダを右クリックし「新規」フォルダー:jsp 運用 javaのクラスファイルはmodelフォルダに入れる servlet はservlet フォルダに入れる jspファイルはWebContent/ENF-WEB/jsp に入れる。ここに置いたjspファイルはservletから(redirect,forward)で呼ばないと開かない。 外部からアクセスできるjspは WebContent 直下に入れる スコープ:共有みたいなところ スコープにはインスタンス(クラスからnewしたもの)しか置けない。 intやdoubleは置けないが String はおける(Stringはそれ自体がオブジェクトだから)。 添付ファイル:macのファイルなのでwindowsで関係ないファイルが見えることがあるかもしれません。削除しても放置しても構いません。 Chap99.zip 基本 Chap99 -remake.zip フッターを動的インクルードで入れたもの JAVApdf Chap99の説明 java2.pdf 入力チェックの説明 2022/09/14 正規表現 数値でマイナスと小数点を受け付ける:"^[+-]?([1-9]\\d*|0)(\\.\\d+)?$"
https://w.atwiki.jp/ce00582/pages/1136.html
import javax.swing.*; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.RenderingHints; import java.awt.geom.*; import java.awt.Color; import java.awt.BasicStroke; public class dsge27 extends JPanel{ public static void main(String[] args){ JFrame frame = new JFrame(); dsge27 app = new dsge27(); frame.getContentPane().add(app); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setBounds(0, 0, 500, 500); frame.setTitle("JAVA DSGE27 労働供給非弾力的"); frame.setVisible(true); } public void paintComponent(Graphics g){ int n; double data[]=new double[101]; Graphics2D g2 = (Graphics2D)g; g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); data=dsge(); for (n=1;n 100;n++){ g2.draw(new Line2D.Double(5*n, 500-500*data[n], 5*n+5,500-500*data[n+1])); } } static double[] dsge(){ double a; double beta; double ks; double h; double k[]=new double[101]; double cx[]=new double[101]; double cp[]=new double[101]; double k1; double n1; int n2; int n3; int n; double c1; double r1; double ep; double maxc; double minc; double data[]=new double[101]; double ct[]=new double[101]; int t; a=0.33; beta=0.95; ks=Math.pow((1 / beta - 1) / a , 1 / (a - 1)); h=2*ks/100; for (n=1;n 101;n++){ k[n]=n*h; cx[n]=Math.pow(k[n],a); } t=0; while(t 100){ for (n=10;n 91;n++){ k1=k[n]+Math.pow(k[n],a)-cx[n]; n1=k1/h; n2=(int)n1; n3=n2+1; c1=cx[n2]+(n1-n2)*(cx[n3]-cx[n2]); r1=a*Math.pow(k1,a-1); cp[n]=c1/(beta*(1+r1)); } ep=0; for (n=10;n 91;n++){ ep=ep+Math.pow(cx[n]-cp[n],2); } for (n=10;n 91;n++){ cx[n]=cp[n]; } if (ep 0.0001)t=1000; t=t+1; } k1=k[47]; for (t=1;t 101;t++){ n1=k1/h; n2=(int)n1; n3=n2+1; c1=cx[n2]+(n1-n2)*(cx[n3]-cx[n2]); k1=k1+Math.pow(k1,a)-c1; ct[t]=c1; } minc=999; for (t=1;t 100;t++){ if (ct[t] minc)minc=ct[t]; } maxc=-999; for (t=1;t 100;t++){ if (ct[t] maxc)maxc=ct[t]; } for (t=1;t 100;t++){ data[t]=(ct[t]-minc)/(maxc-minc); } return data; } }
https://w.atwiki.jp/toshi_oboegaki/pages/39.html
メルセンヌツイスター 配列の簡単な出力方法 メルセンヌツイスター //引用元//http //www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/VERSIONS/JAVA/PATCH/MTRandom.java import java.util.Random;public class MersenneTwister extends Random {private static final long serialVersionUID = -515082678588212038L; // Constants used in the original C implementationprivate final static int UPPER_MASK = 0x80000000;private final static int LOWER_MASK = 0x7fffffff; private final static int N = 624;private final static int M = 397;private final static int MAGIC[] = { 0x0, 0x9908b0df };private final static int MAGIC_FACTOR1 = 1812433253;private final static int MAGIC_FACTOR2 = 1664525;private final static int MAGIC_FACTOR3 = 1566083941;private final static int MAGIC_MASK1 = 0x9d2c5680;private final static int MAGIC_MASK2 = 0xefc60000;private final static int MAGIC_SEED = 19650218;private final static long DEFAULT_SEED = 5489L; // Internal stateprivate transient int[] mt;private transient int mti;private transient boolean compat = false; // Temporary buffer used during setSeed(long)private transient int[] ibuf; public MersenneTwister() { this.setSeed(System.currentTimeMillis());} public MersenneTwister(boolean compatible) {super(0L);compat = compatible;setSeed(compat ? DEFAULT_SEED System.currentTimeMillis());} public MersenneTwister(long seed) { super(seed);this.setSeed(seed);} public MersenneTwister(byte[] buf) {super(0L);setSeed(buf);} public MersenneTwister(int[] buf) {super(0L);setSeed(buf);} // Initializes mt[N] with a simple integer seed. This method is// required as part of the Mersenne Twister algorithm but need// not be made public.private final void setSeed(int seed) { // Annoying runtime check for initialisation of internal data// caused by java.util.Random invoking setSeed() during init.// This is unavoidable because no fields in our instance will// have been initialised at this point, not even if the code// were placed at the declaration of the member variable.if (mt == null)mt = new int[N]; // ---- Begin Mersenne Twister Algorithm ----mt[0] = seed;for (mti = 1; mti N; mti++) {mt[mti] = (MAGIC_FACTOR1 * (mt[mti - 1] ^ (mt[mti - 1] 30)) + mti);}// ---- End Mersenne Twister Algorithm ----} public final synchronized void setSeed(long seed) {if (compat) {setSeed((int) seed);} else { // Annoying runtime check for initialisation of internal data// caused by java.util.Random invoking setSeed() during init.// This is unavoidable because no fields in our instance will// have been initialised at this point, not even if the code// were placed at the declaration of the member variable.if (ibuf == null)ibuf = new int[2]; ibuf[0] = (int) seed;ibuf[1] = (int) (seed 32);setSeed(ibuf);}} public final void setSeed(byte[] buf) {setSeed(pack(buf));} public final synchronized void setSeed(int[] buf) {int length = buf.length;if (length == 0)throw new IllegalArgumentException("Seed buffer may not be empty");// ---- Begin Mersenne Twister Algorithm ----int i = 1, j = 0, k = (N length ? N length);setSeed(MAGIC_SEED);for (; k 0; k--) {mt[i] = (mt[i] ^ ((mt[i - 1] ^ (mt[i - 1] 30)) * MAGIC_FACTOR2))+ buf[j] + j;i++;j++;if (i = N) {mt[0] = mt[N - 1];i = 1;}if (j = length)j = 0;}for (k = N - 1; k 0; k--) {mt[i] = (mt[i] ^ ((mt[i - 1] ^ (mt[i - 1] 30)) * MAGIC_FACTOR3))- i;i++;if (i = N) {mt[0] = mt[N - 1];i = 1;}}mt[0] = UPPER_MASK; // MSB is 1; assuring non-zero initial array// ---- End Mersenne Twister Algorithm ----} protected final synchronized int next(int bits) {// ---- Begin Mersenne Twister Algorithm ----int y, kk;if (mti = N) { // generate N words at one time // In the original C implementation, mti is checked here// to determine if initialisation has occurred; if not// it initialises this instance with DEFAULT_SEED (5489).// This is no longer necessary as initialisation of the// Java instance must result in initialisation occurring// Use the constructor MersenneTwister(true) to enable backwards// compatible behaviour. for (kk = 0; kk N - M; kk++) {y = (mt[kk] UPPER_MASK) | (mt[kk + 1] LOWER_MASK);mt[kk] = mt[kk + M] ^ (y 1) ^ MAGIC[y 0x1];}for (; kk N - 1; kk++) {y = (mt[kk] UPPER_MASK) | (mt[kk + 1] LOWER_MASK);mt[kk] = mt[kk + (M - N)] ^ (y 1) ^ MAGIC[y 0x1];}y = (mt[N - 1] UPPER_MASK) | (mt[0] LOWER_MASK);mt[N - 1] = mt[M - 1] ^ (y 1) ^ MAGIC[y 0x1]; mti = 0;} y = mt[mti++]; // Temperingy ^= (y 11);y ^= (y 7) MAGIC_MASK1;y ^= (y 15) MAGIC_MASK2;y ^= (y 18);// ---- End Mersenne Twister Algorithm ----return (y (32 - bits));} // This is a fairly obscure little code section to pack a// byte[] into an int[] in little endian ordering. public static int[] pack(byte[] buf) {int k, blen = buf.length, ilen = ((buf.length + 3) 2);int[] ibuf = new int[ilen];for (int n = 0; n ilen; n++) {int m = (n + 1) 2;if (m blen)m = blen;for (k = buf[--m] 0xff; (m 0x3) != 0; k = (k 8) | buf[--m] 0xff);ibuf[n] = k;}return ibuf;} } 配列の簡単な出力方法 import java.util.Arrays; public class TestClass {public static void main(String[] args) {double d[] = new double[3];d[0] = 1.0;d[1] = 2.0;d[2] = 3.0;System.out.println( Arrays.toString( d ) ); String str[] = new String[3];str[0] = "abc";str[1] = "ABC";str[2] = "TEST";System.out.println( Arrays.toString( str ) );}}
https://w.atwiki.jp/picolit/pages/14.html
イヌでもわかるJavaScript講座
https://w.atwiki.jp/jacoby/pages/38.html
JNI C++/C - Java メモリ管理 DeleteLocalRef() ReleaseStringUTFChars() を使うといいらしい。 * GetStringChars - ReleaseStringchars GetStringUTFChars - ReleaseStringUTFChars GetStringCritical- ReleaseStringCritical GetBooleanArrayElements- ReleaseBooleanArrayElements GetByteArrayElements- ReleaseByteArrayElements GetCharArrayElements- ReleaseCharArrayElements GetShortArrayElements- ReleaseShortArrayElements GetIntArrayElements- ReleaseIntArrayElements GetLongArrayElements- ReleaseLongArrayElements GetFloatArrayElements- ReleaseFloatArrayElements GetDoubleArrayElements- ReleaseDoubleArrayElements DeleteGlobalRef void DeleteGlobalRef(JNIEnv *env, jobject globalRef); globalRef によって示されたグローバル参照を削除します。 リンケージ JNIEnv インタフェース関数テーブルのインデックス 22 パラメータ env JNI インタフェースポインタ globalRef グローバル参照 ローカル参照 ローカル参照は、ネイティブメソッドの呼び出し期間中有効です。ローカル参照は、ネイティブメソッドが復帰すると自動的に解放されます。各ローカル参照は、Java 仮想マシンのリソースをいくらか消費します。プログラマは、ネイティブメソッドがローカル参照を過剰に割り当てないように確認する必要があります。ローカル参照は、ネイティブメソッドが Java に復帰すると自動的に解放されますが、ローカル参照を過剰に割り当てると、ネイティブメソッドの実行中に VM がメモリを使い果たしてしまう可能性があります。 DeleteLocalRef void DeleteLocalRef(JNIEnv *env, jobject localRef); localRef によって示されたローカル参照を削除します。 リンケージ JNIEnv インタフェース関数テーブルのインデックス 23 パラメータ env JNI インタフェースポインタ localRef ローカル参照 JNIの関数一覧 http //java.sun.com/j2se/1.5.0/ja/docs/ja/guide/jni/spec/functions.html ○JNI のメモリ開放について http //java-house.jp/ml/archive/j-h-b/044868.html 例外 FindClass ClassFormatError クラスデータが有効なクラスを指定しなかった場合 ClassCircularityError クラスまたはインタフェースが、それ自体のスーパークラスまたはスーパーインタフェースになる場合 NoClassDefFoundError 要求されたクラスまたはインタフェースに対する定義が見つからなかった場合 OutOfMemoryError システムがメモリ不足の場合 GetStaticMethodID NoSuchMethodError 指定された static メソッドが見つからない場合 ExceptionInInitializerError 例外のため、クラス初期化が失敗した場合 OutOfMemoryError システムがメモリ不足の場合 IsInstanceOf 発生しない GetArrayLength 発生しない GetIntArrayElements 発生しない NewStringUTF OutOfMemoryError システムがメモリ不足の場合 参考URL http //www.ne.jp/asahi/hishidama/home/tech/java/jni_code.html
https://w.atwiki.jp/kimikage/pages/14.html
Java ■IDE Eclipse Standard/SDK Version Kepler Service Release 1 Build id 20130919-0819 http //www.eclipse.org/のダウンロードページから入手 ■Java JRE7 http //java.sun.com/javase/ja/6/download.htmlから入手 メモ eclipse操作メモ フレームを表示する レイアウトマネージャ ボタンクリック パネルに描画 スレッド SQL Serverに接続 enum abstractのわっさ~が嫌いな時 Java generic JSPメモ jsp javaコードを挿入 jsp request jsp session jsp ページ転送 jsp マスタページ的な何か jsp MessageDigest jsp string.format jsp Comparable(比較インタフェース)